<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="/common/commonCss.jsp"></jsp:include>
<jsp:include page="/common/commonJs.jsp"></jsp:include>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<script type="text/javascript"
	src="${basePath }commonJs/quinn_commons.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		setInterval(updateTime, 1000);
		initTable('form1', 'table1', 'foot1', callback1);
	});

	function updateTime() {
		var now = new Date();
		var date = "";
		var y = now.getFullYear();
		var m = now.getMonth() + 1;
		var d = now.getDay();
		date += y + "-" + m + "-" + d;
		$("#data_1").html(now.toLocaleString());
	}

	function initTable(formid, tableid, footid, callback) {
		var form = $("#" + formid);
		var pagebean = new PageBean(form);
		pagebean.setCallback(callback);
		pagebean.setFootId(footid);
		pagebean.setTableId(tableid);
		setPagebeanObj(pagebean);
		pagebean.doPage();
	}

	function callback1(data) {
		$.each(data, function(ind, obj) {
			obj = emptyJson(obj);
			var tr = "<tr>";
			tr += "<td>" + obj.fkOrderId + "</td>";
			tr += "<td>" + obj.time + "</td>";
			tr += "<td>" + obj.cusName + "</td>";
			tr += "<td>" + obj.amount + "</td>";
			tr += "</tr>";
			$("#table1").find("tr:eq(" + ind + ")").after(tr);
		});
	}
	function callback2(data) {
		$.each(data, function(ind, obj) {
			obj = emptyJson(obj);
			var tr = "<tr>";
			tr += "<td>" + obj.fkOrderId + "</td>";
			tr += "<td>" + obj.time + "</td>";
			tr += "<td>" + obj.cusName + "</td>";
			tr += "<td>" + obj.amount + "</td>";
			tr += "</tr>";
			$("#table2").find("tr:eq(" + ind + ")").after(tr);
		});
	}
	function callback3(data) {
		$.each(data, function(ind, obj) {
			obj = emptyJson(obj);
			var tr = "<tr>";
			tr += "<td>" + obj.fkOrderId + "</td>";
			tr += "<td>" + obj.time + "</td>";
			tr += "<td>" + obj.cusName + "</td>";
			tr += "<td>" + obj.amount + "</td>";
			tr += "</tr>";
			$("#table3").find("tr:eq(" + ind + ")").after(tr);
		});
	}
	function callback4(data) {
		$.each(data, function(ind, obj) {
			obj = emptyJson(obj);
			var tr = "<tr>";
			tr += "<td>" + obj.fkOrderId + "</td>";
			tr += "<td>" + obj.time + "</td>";
			tr += "<td>" + obj.cusName + "</td>";
			tr += "<td>" + obj.amount + "</td>";
			tr += "</tr>";
			$("#table4").find("tr:eq(" + ind + ")").after(tr);
		});
	}

	function print() {
		var xj = $("#xj").html();
		var yh = $("#yh").html();
		var cz = $("#cz").html();
		var lj = $("#lj").html();
		$.ajax({
			url : "${basePath}payment/printPaymentDetail.shtml",
			type : "post",
			dataType : "json",
			data : {
				xj : xj,
				yh : yh,
				cz : cz,
				lj : lj
			}
		});
	}
</script>

<title>首页</title>
</head>
<body class="bg">
	<div class="content m_auto">
		<div class="content_l mt10">
			<ul>
				<shiro:hasPermission name="payment/skmx.shtml">
					<li><a href="${basePath }payment/skmx.shtml"><i
							class="nav_icon_k"></i><br>收款</a></li>
				</shiro:hasPermission>
				<shiro:hasPermission name="payment/symx.shtml">
					<li class="content_hover"><a
						href="${basePath }payment/symx.shtml"><i class="nav_icon_l"></i><br>收银明细</a></li>
				</shiro:hasPermission>
			</ul>
		</div>
		<form action="${basePath }payment/paginate.shtml" id="form1"
			method="post">
			<input type="hidden" name="pageSize" value="10"> <input
				type="hidden" name="pageNo" value="1">
		</form>
		<form action="${basePath }payment/paginate.shtml" id="form2"
			method="post">
			<input type="hidden" name="pageSize" value="10"> <input
				type="hidden" name="pageNo" value="1"><input type="hidden"
				name="payMethod" value="1">
		</form>
		<form action="${basePath }payment/paginate.shtml" id="form3"
			method="post">
			<input type="hidden" name="pageSize" value="10"> <input
				type="hidden" name="pageNo" value="1"><input type="hidden"
				name="payMethod" value="3">
		</form>
		<form action="${basePath }payment/paginate.shtml" id="form4"
			method="post">
			<input type="hidden" name="pageSize" value="10"> <input
				type="hidden" name="pageNo" value="1"><input type="hidden"
				name="payMethod" value="2">
		</form>
		<div class="content_r mt10">
			<div class="p20">
				<div class="symore_div fl f14">
					<h2 class="f18">收银明细</h2>
					<ul>
						<li><label>现金金额：</label><span id="xj">${xj }元</span></li>
						<li><label>刷卡金额：</label><span id="yh">${yh }元</span></li>
						<li><label>储值消费金额：</label><span id="cz">${cz }元</span></li>
						<li><label>今日累计收入：</label><span id="lj">${xj+cz+yh }元</span></li>
					</ul>
					<p class="mt100">
						日期：<span id="data_1"></span>
					</p>
					<input type="button" class="btn mt20" value="打印" onclick="print()">
				</div>
				<div class="tab_normal fl w800">
					<ul class=" fixed" id="tab_a">
						<li onclick="initTable('form1','table1','foot1',callback1)">全部</li>
						<li onclick="initTable('form2','table2','foot2',callback2)">现金消费详情</li>
						<li onclick="initTable('form3','table3','foot3',callback3)">刷卡消费详情</li>
						<li onclick="initTable('form4','table4','foot4',callback4)">储蓄消费详情</li>
					</ul>
					<ul class="fixed" id="tab_conbox_a">
						<li class="p10 h450">
							<table class=" table" id="table1">
								<tr>
									<th>订单</th>
									<th>时间</th>
									<th>顾客</th>
									<th>金额</th>
								</tr>
							</table> <!----翻页----->
							<div class="page fr m10" id="foot1"></div> <!----翻页----->
						</li>
						<li class="p10 h450">
							<table class=" table" id="table2">
								<tr>
									<th>订单</th>
									<th>时间</th>
									<th>顾客</th>
									<th>金额</th>
								</tr>
							</table> <!----翻页----->
							<div class="page fr m10" id="foot2"></div> <!----翻页----->
						</li>
						<li class="p10 h450">
							<table class=" table" id="table3">
								<tr>
									<th>订单</th>
									<th>时间</th>
									<th>顾客</th>
									<th>金额</th>
								</tr>
							</table> <!----翻页----->
							<div class="page fr m10" id="foot3"></div> <!----翻页----->
						</li>
						<li class="p10 h450">
							<table class=" table" id="table4">
								<tr>
									<th>订单</th>
									<th>时间</th>
									<th>顾客</th>
									<th>金额</th>
								</tr>
							</table> <!----翻页----->
							<div class="page fr m10" id="foot4"></div> <!----翻页----->
						</li>
					</ul>
				</div>

			</div>
		</div>
	</div>



	<!---弹出层--->
	<div id="e" class="easyui-window" title="特殊折扣设置"
		data-options="modal:true,closed:true,iconCls:'icon-save'"
		style="width: 500px; height: 300px; position: relative;">
		<div class="margin_auto w300 pt30">
			<ul class="ul_label f14">
				<li><label>折扣率：</label><input type="text" class="iput_t"></li>
				<li><label>经理密码：</label><input type="text" class="iput_t"></li>
			</ul>
		</div>
		<div class="btm_btn btm_bg">
			<dl>
				<dd>
					<input type="button" class="btn" onClick="javascript:alert('ok')"
						value="确定">
				</dd>
				<dd>
					<input type="button" class="btn" onClick="javascript:alert('ok')"
						value="取消">
				</dd>
			</dl>
		</div>
	</div>
	<!---弹出层--->


</body>
</html>